﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SQLIOSimParser
{
    public partial class AdditionalReportInfo : Form
    {
        DataSet dsResults;

        public AdditionalReportInfo(DataSet dsResults)
        {
            InitializeComponent();
            this.dsResults = dsResults;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = string.Empty;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                txtPathCustomerLogo.Text = openFileDialog1.FileName;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtPathCustomerLogo.Text) && !File.Exists(txtPathCustomerLogo.Text))
            {
                MessageBox.Show("Path to customer image is not valid or Access denied.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ReportViewer rw = new ReportViewer(dsResults.Tables[1],txtCustomerName.Text, txtProjectInformation.Text, txtPathCustomerLogo.Text);
            rw.ShowDialog();
        }

    }
}
